<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * User
 *
 * @ORM\Table(name="user")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
 */
class User
{
    use TimestampableEntity;

    public static function dropdown($column, $value = null)
    {
        $dropDownList = [
            'on_job'=>[
                self::TYPE_ON_JOB =>'在职',
                self::TYPE_NOT_ON_JOB=>'离职',
            ],
        ];
        if ($value !== null)
            return array_key_exists($column, $dropDownList) && isset($dropDownList[$column][$value]) ? $dropDownList[$column][$value] : false;
        else
            return array_key_exists($column, $dropDownList) ? $dropDownList[$column] : false;
    }

    private $_options;

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="username", type="string", length=255, nullable=true)
     * @Assert\NotBlank()
     */
    private $username = '';

    /**
     * @var string
     *
     * @ORM\Column(name="password", type="string", length=255, nullable=false)
     * @Assert\NotBlank()
     */
    private $password = '';

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
     */
    private $name = '';

    /**
     * @var string
     *
     * @ORM\Column(name="mobile", type="string", length=255, nullable=false)
     */
    private $mobile = '';

    /**
     * @var string
     *
     * @ORM\Column(name="phone", type="string", length=50, nullable=false)
     */
    private $phone = '';

    /**
     * @var string
     *
     * @ORM\Column(name="email", type="string", length=255, nullable=false)
     */
    private $email = '';

    /**
     * @var string
     *
     * @ORM\Column(name="sex", type="string", length=255, nullable=false)
     */
    private $sex = '';

    /**
     * @var string
     *
     * @ORM\Column(name="duty", type="string", length=255, nullable=false)
     */
    private $duty = '';

    /**
     * @var integer
     *
     * @ORM\Column(name="power", type="integer", nullable=false)
     */
    private $power = '0';

    const POWER_ADMIN = 0;
    const POWER_USER = 1;

    /**
     * @var integer
     *
     * @ORM\Column(name="depart_id", type="integer", nullable=false)
     */
    private $departId = '0';

    /**
     * @var integer
     *
     * @ORM\Column(name="company_id", type="integer", nullable=false)
     */
    private $companyId;

    /**
     * @var integer
     *
     * @ORM\Column(name="role_id", type="integer", nullable=false)
     */
    private $roleId = '0';

    /**
     * @var integer
     *
     * @ORM\Column(name="on_job", type="integer", nullable=false)
     */
    private $onJob = '0';

    const TYPE_ON_JOB = 0;
    const TYPE_NOT_ON_JOB = 1;

    /**
     * @var integer
     *
     * @ORM\Column(name="phone_type", type="integer", nullable=false)
     */
    private $phoneType = '0';

    const TYPE_PC = 0;
    const TYPE_ANDROID = 1;
    /**
     * @var \DateTime
     * @ORM\Column(type="datetime")
     */
    private $startAt;

    /**
     * @var \DateTime
     * @ORM\Column(type="datetime")
     */
    private $unitStartAt;


    public function getOptions()
    {
        return $this->_options;
    }

    public function setOptions($options)
    {
        $this->_options = $options;
    }
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set username
     *
     * @param string $username
     *
     * @return User
     */
    public function setUsername($username)
    {
        $this->username = $username;

        return $this;
    }

    /**
     * Get username
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Set password
     *
     * @param string $password
     *
     * @return User
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Get password
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Set name
     *
     * @param string $name
     *
     * @return User
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set mobile
     *
     * @param string $mobile
     *
     * @return User
     */
    public function setMobile($mobile)
    {
        $this->mobile = $mobile;

        return $this;
    }

    /**
     * Get mobile
     *
     * @return string
     */
    public function getMobile()
    {
        return $this->mobile;
    }

    /**
     * Set phone
     *
     * @param string $phone
     *
     * @return User
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;

        return $this;
    }

    /**
     * Get phone
     *
     * @return string
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * Set email
     *
     * @param string $email
     *
     * @return User
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set sex
     *
     * @param string $sex
     *
     * @return User
     */
    public function setSex($sex)
    {
        $this->sex = $sex;

        return $this;
    }

    /**
     * Get sex
     *
     * @return string
     */
    public function getSex()
    {
        return $this->sex;
    }

    /**
     * Set duty
     *
     * @param string $duty
     *
     * @return User
     */
    public function setDuty($duty)
    {
        $this->duty = $duty;

        return $this;
    }

    /**
     * Get duty
     *
     * @return string
     */
    public function getDuty()
    {
        return $this->duty;
    }

    /**
     * Set power
     *
     * @param integer $power
     *
     * @return User
     */
    public function setPower($power)
    {
        $this->power = $power;

        return $this;
    }

    /**
     * Get power
     *
     * @return integer
     */
    public function getPower()
    {
        return $this->power;
    }

    /**
     * Set departId
     *
     * @param integer $departId
     *
     * @return User
     */
    public function setDepartId($departId)
    {
        $this->departId = $departId;

        return $this;
    }

    /**
     * Get departId
     *
     * @return integer
     */
    public function getDepartId()
    {
        return $this->departId;
    }

    /**
     * Set companyId
     *
     * @param integer $companyId
     *
     * @return User
     */
    public function setCompanyId($companyId)
    {
        $this->companyId = $companyId;

        return $this;
    }

    /**
     * Get companyId
     *
     * @return integer
     */
    public function getCompanyId()
    {
        return $this->companyId;
    }

    /**
     * Set roleId
     *
     * @param integer $roleId
     *
     * @return User
     */
    public function setRoleId($roleId)
    {
        $this->roleId = $roleId;

        return $this;
    }

    /**
     * Get roleId
     *
     * @return integer
     */
    public function getRoleId()
    {
        return $this->roleId;
    }

    /**
     * Set onJob
     *
     * @param boolean $onJob
     *
     * @return User
     */
    public function setOnJob($onJob)
    {
        $this->onJob = $onJob;

        return $this;
    }

    /**
     * Get onJob
     *
     * @return boolean
     */
    public function getOnJob()
    {
        return $this->onJob;
    }

    public function getOnJobLabel()
    {
        return self::dropdown('on_job',$this->onJob);
    }

    /**
     * Set phoneType
     *
     * @param integer $phoneType
     *
     * @return User
     */
    public function setPhoneType($phoneType)
    {
        $this->phoneType = $phoneType;

        return $this;
    }

    /**
     * Get phoneType
     *
     * @return integer
     */
    public function getPhoneType()
    {
        return $this->phoneType;
    }

    /**
     * Set startAt
     *
     * @param \DateTime $startAt
     *
     * @return User
     */
    public function setStartAt(\DateTime $startAt)
    {
        $this->startAt = $startAt;

        return $this;
    }

    /**
     * Get startAt
     *
     * @return \DateTime
     */
    public function getStartAt()
    {
        return $this->startAt;
    }

    /**
     * Set unitStartAt
     *
     * @param \DateTime $unitStartAt
     *
     * @return User
     */
    public function setUnitStartAt(\DateTime $unitStartAt)
    {
        $this->unitStartAt = $unitStartAt;

        return $this;
    }

    /**
     * Get unitStartAt
     *
     * @return \DateTime
     */
    public function getUnitStartAt()
    {
        return $this->unitStartAt;
    }
}
